import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'
import { Merchant } from 'src/entities/Merchant';
import { Repository } from 'typeorm';

@Injectable()
export class MerchantService {
    constructor(
        @InjectRepository(Merchant) protected repository:Repository<Merchant>
    ){}

    async merchant(merchantId:number, fields?:(keyof Merchant)[]) {
        let merchant = await this.repository.findOne(merchantId, {
            select : fields
        })

        return merchant
    }
}
